package com.miplus.ccrm.workflow.model.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum WorkflowStatusEnum {

    // 上架市场状态枚举
    NOT_SHELVED(0, "未上架"),
    SHELVED(1, "已上架"),

    // 审核状态枚举
    AUDIT_PENDING(0, "待审核"),
    AUDIT_REVIEWING(1, "审核中"),
    AUDIT_APPROVED(2, "审核通过"),
    AUDIT_REJECTED(3, "审核不通过"),

    // 启用状态枚举(有任务关联不可停止)
    DISABLED(0, "禁用"),
    ENABLED(1, "启用"),

    //发布状态枚举(已发布才可以上线,改为未发布可以编辑)
    NOT_PUBLISHED(0, "未发布"),
    PUBLISHED(1, "已发布");


    private final Integer code;
    private final String name;

    public static String getNameByCode(Integer code) {
        for (WorkflowStatusEnum value : values()) {
            if (value.code.equals(code)) {
                return value.name;
            }
        }
        return null;
    }
}
